package com.edu.project.activity;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;


import com.edu.project.utils.RxUtils;

import butterknife.ButterKnife;

/**
 * Created by sheng on 2016/11/4.
 */
public abstract class BaseActivity extends AppCompatActivity {

    private  Context mContext;
    private  Activity activity;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mContext = getApplicationContext();
        activity = this;
        setContentView(loadContentView());
        ButterKnife.bind(this);
    }

    public void Toast(String content) {
        Toast.makeText(this, content, Toast.LENGTH_SHORT).show();
    }

    public  Context getmContext() {
        return mContext;
    }

    public  Activity getActivity() {
        return activity;
    }

    protected abstract int loadContentView();

    @Override
    protected void onDestroy() {
        super.onDestroy();
        RxUtils.unsubscribe();
    }
}
